﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Husb.Util;
using CentralOffice.Task.Data;
using CentralOffice.Task.BusinessActions;

using ProgressTable = CentralOffice.Task.Data.TaskProgressDataSet.TaskProgressDataTable;
using ProgressRow = CentralOffice.Task.Data.TaskProgressDataSet.TaskProgressRow;

namespace CentralOffice.WebClient.Tasks
{
    public partial class ProjectLog : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {

            gv.PageIndex = 0;

            ProgressRow progress = (new TaskProgressDataSet()).TaskProgress.NewTaskProgressRow();
            progress.Project = txtProject.Text;
            progress.CreatedBy = txtCreateBy.Text;
            //progress.Accepter = txtAccepter.Text;

            if (txtArrangedDate.Text.Length > 0)
            {
                progress.ArrangedDate = DateTime.Parse(txtArrangedDate.Text);
            }
            if (txtArrangedDateEnd.Text.Length > 0)
            {
                progress.ArrangedDateEnd = DateTime.Parse(txtArrangedDateEnd.Text);
            }
            //task.CloseDate = txtCloseDate.Text;
            //task.Profile = txtProfile.Text;

            odsTaskProcess.SelectParameters.Clear();
            odsTaskProcess.SelectParameters.Add("whereClause", progress.FilterExpression);

        }

        protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
        {
        }

        protected void odsTaskProcess_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            //string where = " AND (Sponsor LIKE '%{0}%' OR Accepter LIKE '%{0}%')";
            //if (e.InputParameters["whereClause"] == null || e.InputParameters["whereClause"].ToString() == "")
            //{
            //    e.InputParameters["whereClause"] = String.Format(where, CommonUtil.TrimAll(ApplicationContext.ActualUserName));
            //}
            //else
            //{
            //    e.InputParameters["whereClause"] = e.InputParameters["whereClause"] + String.Format(where, CommonUtil.TrimAll(ApplicationContext.ActualUserName));
            //}
        }
    }
}
